import javassist.expr.Instanceof;

import org.codehaus.groovy.grails.web.converters.marshaller.xml.CollectionMarshaller

import com.directv.engineertools.channelblocking.Channel

import grails.converters.XML

class BootStrap {

    def init = { servletContext ->
		// Register custom collection marshaller for List with Channel instances.
		// The root element name is set to ssBlockedProviders.
		XML.registerObjectMarshaller(new CollectionMarshaller() {
			@Override
			public boolean supports(Object object) {
				object instanceof List && object.first() instanceof Channel
			}
			@Override
			String getElementName(final Object o) {
				'ssBlockedProviders'
			}
		})
    }
    def destroy = {
    }
}
